package com.blb.day13_demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blb.day13_demo.entity.Account;
import com.blb.day13_demo.mapper.AccountMapper;
import com.blb.day13_demo.service.ServiceA;
import com.blb.day13_demo.service.ServiceB;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ServiceBImpl extends ServiceImpl<AccountMapper, Account> implements ServiceB {

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public void testB() {
        Account account = getById(2);
        account.setBalance(9999);
        updateById(account);
//        throw new RuntimeException("testB");
    }
}
